package gaml.text;

import gaml.error.GamlException;
import gaml.yaml.YamlNode;


/**
 * parsing some specific (implementation dependent) type
 * of yaml node from yaml text
 * @author shnireck
 *
 */
public interface YamlTextParser {
	
	
	/**
	 * check if this parser
	 * could parse yaml text from
	 * current line
	 * @param yaml text, that should be parsed 
	 * @return true if this parser is propriate for 
	 * parsing this text, false if not 
	 * @throws GamlException check failed for some reason
	 */
	public boolean isParserFor (YamlText text) throws GamlException;
	
	/**
	 * set node value for current yaml
	 * text string as result of text parsing
	 * @param text yaml text to parse
	 * @return yaml line with parsed node value
	 * @throws GamlException
	 */
	public String getParsingTail (YamlText text) throws GamlException;

	/**
	 * create a real node of specific type from
	 * yaml text
	 * @param yamlText text to parse
	 * @return yaml node, parsed from text
	 * @throws GamlException if node line formatted incorrectly
	 */
	public YamlNode parseText (YamlText text, YamlNode parent) throws GamlException;
}